package co.baiku.boot.orm.service.impl;

import co.baiku.boot.core.orm.dao.BaseDAO;
import co.baiku.boot.core.orm.service.impl.BaseServiceImpl;
import co.baiku.boot.orm.dao.UserAdminDAO;
import co.baiku.boot.orm.dto.UserAdminDto;
import co.baiku.boot.orm.po.UserAdmin;
import co.baiku.boot.orm.service.UserAdminService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Transactional(rollbackFor = Exception.class)
@Service
public class UserAdminServiceImpl extends BaseServiceImpl<UserAdmin, UserAdminDto, Long> implements UserAdminService {
    @Resource
    private UserAdminDAO userAdminDAO;


    @Override
    protected BaseDAO<UserAdmin, Long> getBaseDAO() {
        return userAdminDAO;
    }

    @Override
    public UserAdmin findFirstByAccount(String account) {
        QueryWrapper<UserAdmin> queryWrapper = new QueryWrapper();
        queryWrapper.eq("account", account);
        return userAdminDAO.selectOne(queryWrapper);
    }
}
